miu1=4*pi*1e-7;
epsilong1=1e-9/(36*pi);
Ei0=5;
w=2*pi*1e8;
z=[-20:0.1:0];
m0=zeros(size(z));
k1=w*sqrt(miu1*epsilong1);
niu1=sqrt(miu1/epsilong1);
t=100;
Ei=Ei0*cos(w*t-k1*z);
Hi=Ei0*cos(w*t-k1*z)/niu1;
Er0=-Ei0;
Er=Er0*cos(w*t+k1*z);
Hr=-Er0*cos(w*t+k1*z)/niu1;
plot3(z,m0,Ei,'r','LineWidth',1.5);
hold on
plot3(z,Hi,m0,'r','LineWidth',1.5);
hold on
plot3(z,m0,Er,'g','LineWidth',1.5);
hold on
plot3(z,Hr,m0,'b','LineWidth',1.5);
hold on
plot3(0,0,20,'LineWidth',1.5);
